﻿using System;
using System.Diagnostics;
using System.Runtime.Serialization;

namespace RockBus.DataContracts
{
    [DataContract(Namespace = StringConstants.RockBusNamespace)]
    public class ProcessorInfo
    {
        public static readonly string DefaultMachineName = Environment.MachineName;

        public static readonly int DefaultProcessId = Process.GetCurrentProcess().Id;

        public static readonly int DefaultAppDomainId = AppDomain.CurrentDomain.Id;

        public static readonly string DefaultProcessorId = Guid.NewGuid().ToString();

        public ProcessorInfo()
        {
            this.MachineName = ProcessorInfo.DefaultMachineName;
            this.ProcessId = ProcessorInfo.DefaultProcessId;
            this.AppDomainId = ProcessorInfo.DefaultAppDomainId;
            this.ProcessorId = ProcessorInfo.DefaultProcessorId;
        }

        [DataMember]
        public string MachineName { get; private set; }

        [DataMember]
        public int ProcessId { get; private set; }

        [DataMember]
        public int AppDomainId { get; private set; }

        [DataMember]
        public string ProcessorId { get; private set; }
    }
}